// import { sharedStylesheetJitUrl } from '@angular/compiler';
import { NgModule, SkipSelf, Optional } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HeaderComponent } from './header/header.component';
import { FooterComponent } from './footer/footer.component';
import { SidebarComponent } from './sidebar/sidebar.component';
import { DomSanitizer } from '@angular/platform-browser';
import { MdIconRegistry } from '@angular/material';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { loadSvgResource } from 'app/utils/svg.utils';
import { SharedModule } from '../shared/shared.module';

@NgModule({
  imports: [
    SharedModule,//这个模块主要引入和导出一些公共的模块
    BrowserAnimationsModule,
    RouterModule
  ],
  declarations: [
    HeaderComponent,
    FooterComponent,
    SidebarComponent,
  ],
  exports: [
    HeaderComponent,
    FooterComponent,
    SidebarComponent
  ]
})
export class CoreModule {
  constructor(
    @Optional() @SkipSelf() parent: CoreModule,
    ir: MdIconRegistry,
    ds: DomSanitizer
  ) {
    if (parent) throw new Error('模块已存在');
    loadSvgResource(ir, ds);
  }
}
